import 'package:flutter/material.dart';
import 'package:xsdk_flutter/xsdk/utils/x_utils_widget.dart';


/*
 page头部折叠器
 */
class XSDKSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {

  late double maxSize;
  late double minSize;

  /*
  [
  XImageUtils.imageLocal(imagePath),
  XWidgetUtils.getLayoutPositioned(child: ,top:20,right: 20,bottom: 20),
  ]
   */
  late List<Widget> children_in_stack;

  XSDKSliverPersistentHeaderDelegate(
      {
        required this.maxSize,
        required this.minSize,
        required List<Widget> children_in_stack,
      }
      );

  @override
  Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
    return XWidgetUtils.getLayoutStack(children:children_in_stack,fit:StackFit.expand);
  }

  //折叠前大小
  @override
  double get maxExtent => maxSize;

  //折叠后大小
  @override
  double get minExtent => minSize;

  @override
  bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
    return true;
  }



}